package cn.edu.hy.demo04.controller;

import cn.edu.hy.demo04.model.User;
import cn.edu.hy.demo04.service.UserService;

import java.util.List;

public class UserController {


    private UserService userService;


    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    //新增
    public String addUser(User user){
//        user.setUserName("test");
//        user.setPassWord("123456");
        //业务逻辑的处理
        userService.addUser(user);

        return "add";
    }


    public String findUserList(User user){

       List<User> userList =userService.findUserList(user);
        for (User cuser:userList){
            System.out.println(cuser.getId()+"-"+cuser.getUserName()+"-"+cuser.getPassWord());
        }
        return "list";
    }




}
